<%@ page language="java"  pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<head>
<link href="<%=request.getContextPath()%>/css/global.css" type="text/css" rel="stylesheet" />
<link href="<%=request.getContextPath() %>/js/easyui/themes/metro/easyui.css" type="text/css" rel="stylesheet"/>
<link href="<%=request.getContextPath() %>/js/date/skin/WdatePicker.css" type="text/css" rel="stylesheet"/>
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath() %>/js/easyui/themes/icon.css">
<script type="text/javascript" src="<%=request.getContextPath() %>/js/jquery.js"></script>
<script type="text/javascript" src="<%=request.getContextPath() %>/js/global.js"></script>
<script type="text/javascript" src="<%=request.getContextPath() %>/js/easyui/easyui.js"></script>
<script type="text/javascript" src="<%=request.getContextPath() %>/js/date/WdatePicker.js"></script>
<script type="text/javascript">

$(function(){

	$("#dataTable").datagrid({
		toolbar: '#dataSearch',
		fitColumns:true,
		striped: true, 
		singleSelect:false,
		pagination:true,
		rownumbers:true,
		SelectOnCheck:true,
		CheckOnSelect:true,
        onSelect: function(index,row){
        	var nos="";
        	var rows = $('#dataTable').datagrid('getSelections');
        	for(var i=0; i<rows.length; i++){
        		nos=nos+rows[i].ck+",";
        	}
			$("#keys").val(nos);
    	},
    	onUnselect: function(index,row){
        	var nos="";
        	var rows = $('#dataTable').datagrid('getSelections');
        	for(var i=0; i<rows.length; i++){
        		nos=nos+rows[i].ck+",";
        	}
			$("#keys").val(nos);
    	},
    	onSelectAll: function(rows){
        	var nos="";
        	for(var i=0; i<rows.length; i++){
        		nos=nos+rows[i].ck+",";
        	}
			$("#keys").val(nos);
    	},
    	onUnselectAll: function(rows){
			$("#keys").val("");
    	}
	});
	
	$('#dataTable').datagrid('getPager').pagination({
		total:<s:property value="pageInfo.pageRecord"/>,
		pageNumber:<s:property value="pageInfo.pageIndex"/>,
		pageSize:<s:property value="pageInfo.pageSize"/>,
		pageList: [20,50,100] ,
		onSelectPage:function(pageNumber,pageSize){  
			toPage(pageNumber,pageSize);
		},
		onRefresh:function(pageNumber,pageSize){  
			location.reload();
		}
	});
	
});

</script>
</head>
<body >
<div id="dataSearch" >    
<form id="sform" action="catalog_list.html" method="get" enctype="multipart/form-data">
<table style="width: 100%;">
<tr>
<td height="25" >
	<b>操作说明:父级编号查询会检索所有子元素</b> 
</td>
</tr>
<tr><td height="30" >
<s:textfield name="catNo" id="catNo"  placeholder="编号"></s:textfield>
<s:textfield name="catName" id="catName"  placeholder="类目名称"></s:textfield>
<s:textfield name="catDad" id="catDad"  placeholder="父级编号"></s:textfield>
<s:select id="catState" name="catState" list="#{'1':'启用','0':'停用'}" headerKey="" headerValue="状态"  />
<s:textfield  id="catDateTop"  name="catDateTop" placeholder="日期起"   onclick="WdatePicker();"  cssStyle="width:100px;" ><s:param name="value"><s:date name="catDateTop" format="yyyy-MM-dd"/></s:param></s:textfield>
 - 
<s:textfield  id="catDateEnd"  name="catDateEnd" placeholder="日期止"   onclick="WdatePicker();"  cssStyle="width:100px;" ><s:param name="value"><s:date name="catDateEnd" format="yyyy-MM-dd"/></s:param></s:textfield>
<input type="button" class="submit" value="查询搜索" onclick="sform.submit();"/></td>
</tr>
<tr><td><hr/></td></tr>
<tr>
<td height="30" >
	<input type="hidden"  id="keys" name="keys"  value=""/>
		<input type="button" class="submit" value="新增记录" onclick="location.href='<%=request.getContextPath()%>/catalog_edit.html'"/>
		<input type="button" class="submit"   value="导出数据"  onclick="if(confirm('确认要执行导出操作吗?')){window.open(location.href.replace('list','export'));}"/>
		&nbsp;&nbsp;&nbsp;&nbsp;
		<input type="button" class="submit" value="日期排序" onclick="toSort('sortField','catDate')"/>
		<input type="button" class="submit" value="编号排序" onclick="toSort('sortField','catNo')"/>
		<input type="button" class="submit" value="父级编号" onclick="toSort('sortField','catDad')"/>
		
		&nbsp;&nbsp;&nbsp;&nbsp;
		<input type="button" class="submit" value="升序排列" onclick="toSort('sortOrder','true')"/>
		<input type="button" class="submit" value="降序排列" onclick="toSort('sortOrder','false')"/>
</td>
</tr>
</table>
</form>
</div>

<table id="dataTable" style="width: 100%;" class="easyui-datagrid" >
<thead>
<tr>
<th data-options="field:'ck'" checkbox="true"></th>
<th data-options="field:'catNo', width:'20%',align:'left' , halign: 'left'">编号</th>
<th data-options="field:'catName', width:'30%',align:'left' , halign: 'left'">名称</th>
<th data-options="field:'catDad', width:'20%',align:'left' , halign: 'left'">父级编号</th>
<th data-options="field:'catState', width:'5%',align:'left' , halign: 'left'">状态</th>
<th data-options="field:'catDate', width:'10%',align:'left' , halign: 'left'">日期</th>
<th data-options="field:'op', width:'100',align:'left' , halign: 'left'">操作</th>

</tr>
</thead>
<tbody>
<s:iterator value="catList" id="show" status="seq">
<tr>
<td><s:property value="#show.catNo"/></td>
<td><s:property value="#show.catNo"/></td>
<td><s:property value="#show.catName"/></td>
<td><s:property value="#show.catDad"/></td>
<td>
		<s:if test="#show.catState==1">
			<img src="<%=request.getContextPath() %>/image/accept.png"  />
		</s:if>
		<s:else>
			<img src="<%=request.getContextPath() %>/image/cancel.png"  />
		</s:else>
</td>
<td><s:text name="global.format.dateminute"><s:param value="#show.catDate"/></s:text>
<td>
<input type="button" value="树状" style="width: 50px;" class="submit" onclick="location.href='<%=request.getContextPath()%>/catalog_tree.html?catDad=<s:property value="#show.catNo"/>'"/>
<input type="button" value="修改" style="width: 50px;"class="submit" onclick="location.href='<%=request.getContextPath()%>/catalog_edit.html?catNo=<s:property value="#show.catNo"/>'"/>
</td>

</tr>
</s:iterator>
</tbody>
</table>
<br/>
<br/>
<br/>
</body>
</html>
